import Vue from "vue";
import VueRouter from "vue-router";
import Panel from "../views/Panel.vue";
import Home from '@/views/Home'
import DetailArt from '@/views/DetailArt'
import Commit from '@/views/Commit'
import DetailAudio from '@/views/DetailAudio'
import Reg from '@/views/Reg'
const originalPush = VueRouter.prototype.push

VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}
Vue.use(VueRouter);

const routes = [
  { path: "/", name: "root", component: Panel },
  { path: "/home", name: "home", component: Home },
  { path: "/commit/:detailType/:id", name: "commit", component: Commit },
  { path: "/detailAudio/:dataType/:id/:playTime", name: "detailAudio", component: DetailAudio },
  { path: "/detailArt/:id", name: "detailArt", component: DetailArt },
  { path: "/reg", name: "reg", component: Reg },
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes,
});

export default router;
